package www.openteam.com.subscribe;

import android.content.Context;
import android.util.Log;

import www.openteam.com.base.BaseSubscriber;
import www.openteam.com.exception.ApiException;
import www.openteam.com.tool.NetworkUtil;

/**
 * Created by kylin on 2016/12/19.
 */

public abstract class CommonSubscriber<T> extends
        BaseSubscriber<T> {

        private Context context;
        private final String TAG=CommonSubscriber.class.getSimpleName();
        public   CommonSubscriber(Context context){
            this.context = context;
        }

    @Override
    public void onStart() {

        if (!NetworkUtil.isNetworkAvailable(context)){
            Log.d(TAG, "网络不可用" );
        }else {
            Log.d(TAG, "网络可用");
        }
    }


    @Override
    protected void onError(ApiException e) {
        Log.d(TAG, "错误信息为 " + "code:" + e.code + "   message:" + e.message);
    }

    @Override
    public void onCompleted() {
        Log.d(TAG, "成功了");
    }

}
